import request from '@/utils/request'

/**
 * 获取教程步骤列表
 */
export function getTutorialSteps(tutorialId) {
  return request({
    url: `/api/admin/tutorial-steps/tutorial/${tutorialId}`,
    method: 'get'
  })
}

/**
 * 获取教程步骤详情
 */
export function getTutorialStepDetail(id) {
  return request({
    url: `/api/admin/tutorial-steps/${id}`,
    method: 'get'
  })
}

/**
 * 创建教程步骤
 */
export function createTutorialStep(data) {
  return request({
    url: '/api/admin/tutorial-steps',
    method: 'post',
    data
  })
}

/**
 * 更新教程步骤
 */
export function updateTutorialStep(data) {
  return request({
    url: `/api/admin/tutorial-steps/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 删除教程步骤
 */
export function deleteTutorialStep(id) {
  return request({
    url: `/api/admin/tutorial-steps/${id}`,
    method: 'delete'
  })
}

/**
 * 批量创建教程步骤
 */
export function batchCreateTutorialSteps(data) {
  return request({
    url: '/api/admin/tutorial-steps/batch',
    method: 'post',
    data
  })
}

/**
 * 重新排序教程步骤
 */
export function reorderTutorialSteps(tutorialId, stepIds) {
  return request({
    url: `/api/admin/tutorial-steps/tutorial/${tutorialId}/reorder`,
    method: 'put',
    data: stepIds
  })
}
